package cn.com.thingo.shyintelligent.ui.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.com.thingo.shyintelligent.R;
import cn.com.thingo.shyintelligent.util.DateUtil;

public class MessageDetailActivity extends AppCompatActivity {
    @BindView(R.id.toolbar_left)
    ImageView ivBack;
    @BindView(R.id.toolbar_title)
    TextView tvTitle;
    @BindView(R.id.message_detail_title)
    TextView tvMessageTitle;
    @BindView(R.id.message_detail_create_time)
    TextView tvMessageCreate;
    @BindView(R.id.message_detail_content)
    TextView tvMessageContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message_detail);
        ButterKnife.bind(this);
        initView();
        initData();
    }

    private void initData() {
        String messageTitle = getIntent().getStringExtra("intent_message_title");
        String messageContent = getIntent().getStringExtra("intent_message_content");
        String messageCreateTime = getIntent().getStringExtra("intent_message_create_time");
        tvMessageTitle.setText(messageTitle);
        tvMessageCreate.setText(DateUtil.long2formatDate2(Long.valueOf(messageCreateTime)));
        tvMessageContent.setText(messageContent);
    }

    private void initView() {
        ivBack.setImageResource(R.mipmap.back);
        tvTitle.setText(R.string.message_detail);

    }

    @OnClick({R.id.toolbar_left})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.toolbar_left:
                finish();
                break;
        }
    }
}
